package sample;

import demo.President;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import org.w3c.dom.*;

import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;

public class Main extends Application {


    @Override
    public void start(Stage primaryStage) throws Exception {
        GridPane pane = new GridPane();
        pane.setAlignment(Pos.CENTER_LEFT);
        pane.setPadding(new Insets(11.5, 12.5, 13.5, 14.5));
        pane.setHgap(5);
        pane.setVgap(5);
        Label label=new Label();
        pane.add(label, 0, 0);

        Text text = new Text();
        pane.add(text, 1, 0);
        Text text2 = new Text();
        pane.add(text2, 0, 6);
        Button btAddPrisedent = new Button("Add Prisedent");
//        President president1=President.getInstance();

        btAddPrisedent.setOnAction(e -> {
            label.setText("Prisedent:");
            President president = President.getInstance();
            String PrisedentName = president.getName();
            text.setText(PrisedentName);
//            System.out.println("1");
            if (president == President.getInstance()) {
                text2.setText("VERIFY: MAOZEDONG!");
            }
        });

        Button btAddCommander = new Button("Add Commander");
        btAddCommander.setOnAction(e -> {
            label.setText("Commander:");
            Commander commander = Commander.getInstance();
            String CommanderName = commander.getName();
            text.setText(CommanderName);
            text2.setText("VERIFY:" + CommanderName);
        });
        pane.add(btAddCommander, 0, 4);
        pane.add(btAdd Prisedent, 0, 3);
        Scene scene = new Scene(pane, 300, 200);
        primaryStage.setScene(scene);
        primaryStage.setTitle("Prisedent");
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
